<?php
// +----------------------------------------------------------------------
// | 有理想的地方，地狱都是天堂。
// +----------------------------------------------------------------------
// | Copyright @ df81.com 版权所有
// +----------------------------------------------------------------------
// | 作者: 南国老符 邮箱：1062129401@qq.com
// +----------------------------------------------------------------------

namespace app\es\controller;
use app\api\model\v1\Common as apiCommonModel;
use think\facade\Db;
use think\facade\View;

class Area extends Base{
	// 列表页
    public function sitemap(){
        // 301重定向
        if(request()->url() == "/area/sitemap" or request()->url() == "/area/sitemap/"){
            header('HTTP/1.1 301 Moved Permanently');//发出301头部
            header('Location: '.request()->domain()."/area/sitemap.html");
        }
        
        // TDK
        $title = $keyword = $page_title = '';
        if(!empty($this->siteRs['keyword'])){
            $keywordArray = explode('，',$this->siteRs['keyword']);
            foreach ($keywordArray as $str){
                $title .= $str.lang('v_company').'-';
                $keyword .= $str.lang('v_company').'，';
            }
            $title = rtrim($title,'-'); $keyword = rtrim($keyword,'，');
            $page_title = $keywordArray[0].lang('v_company');
        }
        View::assign('title',$title); View::assign('keyword',$keyword); View::assign('page_title',$page_title);

        //取出字母
        for($x = ord('a'); $x <= ord('z'); $x++){
            $letterList[] = chr($x);
        }
        View::assign('letterList',$letterList);

        //标签地图
        $areaMap = apiCommonModel::sitemap('area','title,bind_domain,urlroute',$this->lang,$letterList,'area');
        View::assign('areaMap',$areaMap);

        //内页banner
        $pageWhere[] = ['signid','=',1]; $pageWhere[] = ['lang','=',$this->lang];
        $pageWhere[] = ['position','=','about']; $pageWhere[] = ['att_type','=','banner'];
        $pageBanner = Db::name('ad')->where($pageWhere)->value('thumb');
        $pageBanner = !empty($pageBanner) ? $pageBanner : '';
        View::assign('page_banner',$pageBanner);
        
        return view();
	}
}